package lab02.test17;

/**
 * Created by leovo on 2017/10/26.
 */
public class Test {
    public static void main(String[] args) {
int[] numbers=new int[5];//数组的大小

numbers[0]=11;
numbers[1]=0;
numbers[2]=56;
numbers[3]=43;
numbers[4]=67;

//输出打印所有元素的值
// ctrl+d复制一行//ctrl+x删除一行
        System.out.println(numbers[0]);
        System.out.println(numbers[1]);
        System.out.println(numbers[2]);
        System.out.println(numbers[3]);
        System.out.println(numbers[4]);

        //下标
        int index;
        for(index=0;index<5;index++){
            System.out.println(numbers[index]);

        }
        //最大值
        int max=0;
        for(int i=0;i<numbers.length;i++){
            if(numbers[i]>max)
                max=numbers[i];
            if (max==numbers[i]);
        }
        System.out.println("max is:"+ max);

        //最小值
        int min=0;
        for(int i=0;i<numbers.length;i++){
            if(numbers[i]<min)
                min=numbers[i];
        }
        System.out.println("min is:"+ min);

        //求和
        int sum=0;
        for (int i=0;i<numbers.length;i++){
            //累加器
            sum+=numbers[i];
        }
        System.out.println("sum is:"+ sum);
    }
    //求位置

}
